<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head>
    <meta charset="utf-8">
    <title>模板-添加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" th:href="@{/layuiadmin/layui/css/layui.css}" href="../../../layuiadmin/layui/css/layui.css"
          media="all">
    <link rel="stylesheet" th:href="@{/css/layui-form-extend.css}">


</head>
<body>
<div style="padding: 50px;">
    <form th:id="lay-form" class="layui-form" lay-filter="lay-form" id="lay-form"
          th:action="@{/system/authority/add}" method="post">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label lay-required">权限名称：</label>
                <div class="layui-input-inline">
                    <input type="text" name="authorityName" class="layui-input lay-required" lay-verify="required"
                           placeholder="请输入"
                           autocomplete="off">

                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label lay-required">排序：</label>
                <div class="layui-input-inline">
                    <input type="text" name="sort" class="layui-input lay-required" lay-verify="required"
                           placeholder=""
                           autocomplete="off" th:value="${authority.sort}">
                </div>
            </div>

        </div>

        <div class="layui-form-item">
            <label class="layui-form-label lay-required">识别码：</label>
            <div class="layui-input-block">
                <input type="text" name="authorityNameEn" class="layui-input lay-required" lay-verify="required"
                       placeholder="请输入" autocomplete="off" value="ROLE_">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">系统资源：</label>
            <div class="layui-input-block">
                <input type="radio" name="sys" value="1" title="是" checked>
                <input type="radio" name="sys" value="0" title="否">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label lay-required">是否禁用：</label>
            <div class="layui-input-block">
                <input type="radio" name="deleted" value="1" title="是">
                <input type="radio" name="deleted" value="0" title="否" checked>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">授权描述：</label>
            <div class="layui-input-block">
                <textarea name="authorityDesc" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="lay-submit" id="lay-submit" value="确认">
        </div>

    </form>
</div>
<script th:src="@{/layuiadmin/layui/layui.js}" src="../../../layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload'], function () {
        var $ = layui.$
            , form = layui.form
            , upload = layui.upload;
    })
</script>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/jquery.form.js}"></script>

<script type="text/javascript">
    //jquery-form.js   ajax获取submit返回值
    $(function () {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        /** 验证文件是否导入成功  */
        $("#myForm").ajaxForm(function (data) {
            if (data.code == 0) {
                layer.msg("保存成功", {time: 1000}, function () {
                    parent.layui.table.reload("layuiTable", {
                        where: {time: new Date()}
                    });
                    parent.layer.close(index);
                });
            }
        });


    });
</script>


</body>
</html>